<?php
require_once('system/dbConnect.php');
connect();
//获取视频类别列表
$sql_vt="select * from videotype";
$vt_list = fetch_array($sql_vt);
//获取点击排行列表
$sql_hits = "select * from videos order by hittimes desc limit 0,4";
$hits_list = fetch_array($sql_hits);
$sql_downs = "select * from videos order by downtimes desc limit 0,4";
$downs_list = fetch_array($sql_downs);
//获取视频信息
$v_list = array();
foreach($vt_list as $one){
$sql="select * from videos where tid=".$one['tid']." order by vid desc limit 0,6";
$vt = array();
$vt['tid'] = $one['tid'];
$vt['typename'] = $one['typename'];
$vt['list'] = fetch_array($sql);
$v_list[]=$vt;
}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Off Canvas Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/offcanvas.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]>
    <script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="assets/js/ie-emulation-modes-warning.js"></script>
</head>

<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
     
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="inde.php">首页 <span class="sr-only">(current)</span></a></li>
        <?php
            foreach($vt_list as $one){
echo '<li><a href="list.php?id='.$one['tid'].'">'.$one['typename'].'</a></li>';
            }
        ?>
      </ul>
      <form class="navbar-form navbar-left" role="search" action="admin/videosearch.php">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="admin/Login.html" >登录</a></li>
        <li><a href="admin/userreg.html" >注册</a></li>
      
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

<!-- /.navbar -->


<div class="container">
<!--幻灯片开始-->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
        <div class="item active">
            <img src="images/06.jpg" class="img-responsive" alt=" ">

            <div class="carousel-caption">
                <h3>花千骨</h3>

            </div>
        </div>
        <div class="item">
            <img src="images/07.jpg" class="img-responsive" alt=" ">

            <div class="carousel-caption">
                <h3>继承者</h3>

            </div>
        </div>
        <div class="item">
            <img src="images/08.jpg" class="img-responsive" alt=" ">

            <div class="carousel-caption">
                <h3>太子妃升职记</h3>

            </div>
        </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
</div>
<!--幻灯片结束-->



    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-9">

            <div class="row text-center">
            <?php
                foreach($v_list as $vt){
            ?>
            <div class="col-xs-12 col-lg-12 mlist">
                    <h2><?php echo $vt['typename'];?></h2>
                    <ul class="list-inline row text-center">
                <?php 
                foreach($vt['list'] as $one){
                    echo '<li class="col-xs-6 col-md-2">
    <img src="images/'.$one['pic'].'" class="responsive img-thumbnail"/><p><a href="show.php?id='.$one['vid'].'">'.$one['videoname'].'</a></p></li>';
                }
                ?></ul>
                    <p><a class="btn btn-default" href="list.php?id=<?php echo $vt['tid'];?>" role="button">更多 &raquo;</a></p>
                </div>
            <?php
                }
            ?>
               
            </div>
            <!--/row-->
        </div>
        <!--/.col-xs-12.col-sm-9-->

       <div class="col-xs-6 col-sm-3 sidebar-offcanvas">
            <div class="list-group text-center" id="sidebar">
                <h2 style="color:white;" >点击排行</h2>
                <ul class="list-inline row text-center">
                <?php
                foreach($hits_list as $one){
                    echo '<li class="col-xs-12 col-lg-6">
    <img src="images/'.$one['pic'].'" class="responsive img-thumbnail"/>

    <p><a href="show.php?id='.$one['vid'].'">'.$one['videoname'].'</a>
                        </p>
                    </li>';
                }
                ?>   
               </ul>
            </div>

                 <div class="list-group text-center"  id="sidebar">
                <h2 style="color:white;" >下载排行</h2>
                <ul class="list-inline row text-center">
                                
                     <?php
                foreach($downs_list as $one){
                    echo '<li class="col-xs-12 col-lg-6">
    <img src="images/'.$one['pic'].'" class="responsive img-thumbnail"/>
     <p><a href="show.php?id='.$one['vid'].'">'.$one['videoname'].'</a>
                        </p>
                    </li>';
                }
                ?>
                </ul>
            </div>

        </div>
        <!--/.sidebar-offcanvas-->
    </div>
    <!--/row-->

   

</div>
<!--/.container-->
 <hr>

    <footer>
        <p>&copy; Company 2016</p>
    </footer>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>

<script src="offcanvas.js"></script>
<script>
    $('.carousel').carousel({
        interval: 3000 //changes the speed
    })
</script>
</body>
</html>
